﻿using UnityEngine;
using System.Collections;

public class rockObstacle : MonoBehaviour {

	bool falling = true;

	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
	
		if(gameObject.transform.position.y>=19)
		{
			falling = true;
		}

		if( falling == true)
		{
			transform.Translate(0,1,0);
		}

		if( falling == false)
		{
			transform.Translate(0,-0.2f,0);
		}
	}

	void OnCollisionEnter(Collision collision)
	{
		if(collision.gameObject.tag == "floor") 
		{
			falling = false;
		}
		
	}
}
